#include "ALESobel.h"
//#include <opencv2/opencv.hpp>
//#include <opencv2/imgproc/types_c.h>

CALESobel::CALESobel()
{
	
}

CALESobel::CALESobel(CALStepItem* pStepItem)
{
	m_pStepItem = pStepItem;
}

CALESobel::~CALESobel()
{
}


void CALESobel::test()
{

}

void CALESobel::convert()
{
	if (m_pStepItem == NULL) return;

	try
	{
		CALSIESobel* pStepItem = (CALSIESobel*)m_pStepItem;

		//m_dstMat = prewitt(m_srcMat);
		Mat gaosrc, graysrc, xdst, ydst, dst;
		//src = imread(m_strFileName);
		//imshow("input", src);
		GaussianBlur(m_srcMat, gaosrc, Size(3, 3), 0, 0);
		//imshow("gaosioutput", gaosrc);
		cvtColor(gaosrc, graysrc, CV_RGB2GRAY);
		//imshow("grayoutput", graysrc);
		Sobel(graysrc, xdst, -1, 1, 0);
		//imshow("xdst", xdst);
		Sobel(graysrc, ydst, -1, 0, 1);
		//imshow("ydst", ydst);
		addWeighted(xdst, 0.5, ydst, 0.5, 1, m_dstMat);
		//imshow("OUTPUT", dst);

		SetDstType(AL_DST_Mat_One);
	}
	catch (...)
	{

	}
}

void CALESobel::convert(const Mat &src, Mat &dst)
{

}